package io.renren.modules.finance.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 代理提现申请
 *
 * @author meishou
 * @date 2019-05-02 14:36:34
 */
@SuppressWarnings("unused")
@Data
@TableName("finance_withdrawals_app")
public class FinanceWithdrawalsApp implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 结算状态：待审核
     */
    public static final int STATUS_AUDIT = 1;
    /**
     * 结算状态：已提现
     */
    public static final int STATUS_SUCCESS = 2;
    /**
     * 结算状态：已拒绝
     */
    public static final int STATUS_REJECT = 3;
    /**
     * 结算状态：已取消
     */
    public static final int STATUS_CLOSE = 4;

    /**
     * 结算状态：微信
     */
    public static final int METHOD_WECHAT = 1;
    /**
     * 结算状态：支付宝
     */
    public static final int METHOD_ALIPAY = 2;
    /**
     * 结算状态：银行
     */
    public static final int  METHOD_BANK = 3;


    @TableField(exist = false)
    private String name;
    @TableField(exist = false)
    private String mobile;
    @TableField(exist = false)
    private String gradeAliasName;
    @TableField(exist = false)
    private String gradeName;
    @TableField(exist = false)
    private String methodString;
    @TableField(exist = false)
    private String statusString;

    @TableId(type = IdType.AUTO)
    private Integer id; //主键
    private String sn; //申请单号
    private Long userId; //代理ID
    private Integer method; //提现方式 1：微信钱包；2：支付宝；3：银行卡 4：快捷支付
    private BigDecimal amount; //提现金额
    private String accountName; //账号名称
    private String accountNo; //账户帐号
    private Date operateTime; //处理时间
    private Integer operatorId; //处理人ID
    private String reason; //拒绝原因
    private String certificate; //回传凭证
    private Integer tradePaid; //是否进行过三方调用，0：否，1：是
    private String paymentNo; //三方返回结果
    private Integer status; //状态 1：待审核  2：已提现  3：已拒绝  4：已取消
    private Date createTime; //创建时间
    private Date modifyTime; //更新时间

    public String getMethodString() {
        if (StringUtils.isBlank(methodString) && method != null) {
            switch (method) {
                case 1:
                    methodString = "微信钱包";
                    break;
                case 2:
                    methodString = "支付宝";
                    break;
                case 3:
                    methodString = "银行卡";
                    break;
                case 4:
                    methodString = "快捷支付";
                    break;
            }
        }
        return methodString;
    }


    public String getStatusString() {
        if ( status != null) {
            switch (status) {
                case 1:
                    statusString = "待审核";
                    break;
                case 2:
                    statusString = "已提现";
                    break;
                case 3:
                    statusString = "已拒绝";
                    break;
                case 4:
                    statusString = "已取消";
                    break;
            }
        }
        return statusString;
    }

}
